#!/bin/bash

if [ -e target ]; then
	rm -rf target
	rm -rf webroot/PrimitiveServlet.class
fi
mkdir target


echo "test cmd : curl localhost:9002/index.html"
echo "test cmd : curl localhost:9002/servlet/PrimitiveServlet"

# compile
javac -cp ./lib/servlet-api-2.4.jar src/lesson02/org/wzq/*.java src/lesson02/*.java -d target

# mv servlet , classloader load it from webroot
mv target/PrimitiveServlet.class webroot/

# run
java -cp ./lib/servlet-api-2.4.jar:./target org.wzq.HttpServer1